home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / utility / 455 / doc / mupfel.doc < prev    next >
Text File  |  1990-07-20  |  42KB  |  914 lines

  1.          Last change: 29-dec-1989 for Version 1.1
  2.  
  3.         Mupfel  -  Yet Another Commandline Shell
  4.  
  5.         Copyright 1989 by Gereon Steffens.
  6.             All rights reserved.
  7.  
  8. English version of docs by Ton van Overbeek, TVOVERBE@ESTEC.BITNET
  9.  
  10.                 Starting Mupfel
  11.  
  12. When Mupfel is started it tries to execute the file MUPFEL.MUP as a batchfile
  13. (see below) in the current directory. If Mupfel is started with at least one
  14. argument then the first one is used instead of MUPFEL.MUP. If the first
  15. argument is "-c" or "-C" then the following arguments are interpreted as
  16. commands and executed and no start batchfile is executed.
  17.  
  18.  
  19.                 The line editor
  20.  
  21. Mupfel's line editor works together with a so called history.
  22. The size of the history list is selectble (see Internal Variables).
  23. An input line may consist of max 256 characters.
  24. The following keys have a special meaning on input:
  25.     ESC:
  26.         Clears the whole input line
  27.     Return:
  28.         Finishes input. The whole visible input line is processed
  29.         independent from the cursor position.
  30.     Backspace:
  31.         Deletes the character to the left of the cursor.
  32.     Delete:
  33.         Deletes the character under the cursor. At the end of the line
  34.         it has the same effect as backspace.
  35.     Control-Delete:
  36.         Deletes from the current cursor position to the end of line.
  37.     Insert:
  38.         Toggles between insert/overwrite.
  39.         Default is insert mode, which is shown by a static cursor. The
  40.         cursor is blinking in overwrite mode.
  41.     Left/Right arrow:
  42.         Moves the cursor accordingly without changing the input line.
  43.     Shift-Left/Right arrow:
  44.         Moves the cursor to the beginning/end of line respectively.
  45.     Control-Left/Right arrow:
  46.         Moves the cursor to the start of the previous/next word.
  47.     Help:
  48.         Displays the history list.
  49.     Up/Down arrow:
  50.         Scrolls up/down in the history list.
  51.     Shift-Up/Down arrow:
  52.         Scrolls up/down in the history list only showing those entries
  53.         starting with the characters in the current input line. If the
  54.         current line is empty, all entries can be displayed.
  55.     Control-X:
  56.         Exchanges the character under the cursor with the one to the
  57.         right.
  58.     Control-C:
  59.         Changes upper case letters to lower case and vice versa.
  60.  
  61. During input you can scroll through the history list without danger. The line
  62. is buffered internally and is shown again when you scroll down to the latest
  63. entry. If you clear the history line shown during scrolling (with backspace,
  64. DEL or ESC) then the internal pointer for the next line to be shown is reset
  65. to the latest entry.
  66. You can input all character codes between 1 and 255 with the Mupfel line editor.
  67. For characters which are not available on the keyboard you can type the
  68. corresponding numeric code on the numeric keypad while pressing the Alternate 
  69. key. As soon as you release the Alternate key the corresponding character is
  70. generated.
  71.  
  72.  
  73.                 Command line parsing
  74.  
  75. Mupfel splits every input line in tokens. Every character string which is
  76. bounded by space, tab, beginning or end of line is a token. To include spaces
  77. or tabs in a token you need to surround it with a single or double quote
  78. (' or "). These characters are not part of the token. Tokens that contain one
  79. of the characters '*' or '?' or a string between '[' and ']' are so called
  80. wildcards (see below). These wildcards are - if possible- expanded, where
  81. each result generates a new token. In case that no filename matches a wildcard
  82. the original token is left unchanged. The wildcard expansion can be suppressed
  83. by quoting (with ' or "). A token starting with $ is a reference to the
  84. environment. The longest following string of alphanumeric characters is
  85. interpreted as the name of an environment variable. If this variable does
  86. not exist the token is deleted. You can enclose the variable name after the
  87. $ in curly braces ({ and }) to avoid conflicts. ${HOME}1 represents the
  88. contents of the variable HOME followed by a 1. Alternatively you can use
  89. "$HOME"1. Environment references in quoted tokens are only resolved when
  90. using ". When using ' all characters are taken unchanged. Tokens starting with
  91. >, >> or < are interpreted as starting I/O redirection (see below). If the
  92. startup code in a program does the I/O redirection you can quote these tokens.
  93. If a non quoted token starts with ~ then it is replaced with the current
  94. directory. In this way you can pass files in the current directory to GEM
  95. programs which are somewhere else without a lot of typing.
  96. Mupfel allows to put several commands on one line separated by semicolons.
  97. If you need to include semicolons in a token then you have to quote it 
  98. (important for $PATH, $CDPATH and $SUFFIX).
  99.  
  100.  
  101.                 Alias expansion
  102.  
  103. When during the division of the command line into tokens the first token is
  104. complete the alias list (see Alias) is searched for an alias for this name.
  105. If a match is found then the first token is removed, the remaining part of the
  106. input line is appended to the replacement text and the parser is started again.
  107. To avoid infinite recursive aliases and to facilitate easy shorthand for some
  108. commands this alias expansion is only done once.
  109. Examples:
  110.     alias cp 'cp -v'        # Be talkative during copy
  111.     alias locate whereis        # Just another name...
  112.     alias b a
  113.     alias a b            # Input of a starts command b. No loop!
  114.     alias l 'ls -cdf'        # Very usefull
  115.     alias use 'pwd;du .'        # You can use more than one command.
  116.  
  117.  
  118.                 Wildcards
  119.  
  120. Mupfel supports a Unix-like wildcard notation, derived from the so called
  121. "regular expressions". The following wildcard characters are possible:
  122.     *    -    Matches zero or more characters.
  123.     ?    -    Matches exactly one character.
  124.     [...]    -    Matches the characters between [ and ].
  125.     [x-y]    -    Matches all characters from x to y.
  126.     [^...]    -    Matches the characters *not* between [ and ]
  127.             (x-y works too).
  128. These components can be combined in any sequence. For example "[a-f]??[0-9*x"
  129. matches every filename starting with a letter between a and f followed by any 2
  130. characters then a digit and with an x as last character.
  131. NOTE: The wildcard "*" matches _ALL_ filenames, not (as in TOS) only those 
  132. without extension!
  133. NOTE #2: During wildcard expansion files with the hidden attribute (see chmod 
  134. and ls) are _NOT_ considered!
  135.  
  136.                 The environment
  137.  
  138. Mupfel makes a very extensive use of the otherwise not so much used environment
  139. on the ST. The following variables are used:
  140.     SHELL:        The complete path to Mupfel itself. At start composed
  141.             from the current directory and the function shel_read().
  142.     PATH:        Search path for external commands. Single components are
  143.             separated by semicolon or comma.
  144.     COLUMNS:    The number of characters per line. At start computed
  145.             with the VDI function vq_chcells(). The ls and help
  146.             commands use this value.
  147.     ROWS:        The number of lines on the screen. Used by the internal
  148.             more command.
  149.     HOME:        The default directory for cd.
  150.     PS1:        Primary prompt. Used by the command line editor for the
  151.             output of a promptstring. May contain the following
  152.             special sequences:
  153.                 %P    Current drive and directory in upper
  154.                     case
  155.                 %p    As %P, but in lower case
  156.                 %D    Current date
  157.                 %T    Current time
  158.                 %N    CR/LF
  159.                 %%    the % character
  160.                 %i    reverse video on
  161.                 %I    reverse video off
  162.     xARG:        Used for passing arguments with the xARG method.
  163.             See "The xARG method".
  164.     IMV:        Contains the addresses of some internal Mupfel 
  165.             variables. Used for the inheritance of aliases, function
  166.             keys, the hashtable and some other internal variables
  167.             (only interesting for a second Mupfel).
  168.         (Note: the IMV and xARG variables are normally not visible,
  169.         because they are generated immediately before the start of an
  170.         external program and deleted directly afterwards)
  171.     ARGV:        This variable is reserved for the EXARG method (See
  172.             below) and should not be used.
  173.     CDPATH:        Directory searchpath for cd. Single components are
  174.             separated by semicolon or comma.
  175.     SUFFIX:        Contains (a semicolon or comma separated) list of
  176.             extensions to be eused for executable programs. The
  177.             individual components may be max 3 characters long.
  178.             NOTE: Only the contents of $SUFFIX determine if a 
  179.             program is executable. This is important for systems
  180.             which work with load-time linking. You have to take
  181.             into account that $SUFFIX is searched from left to
  182.             right. This means that short extensions must be put
  183.             before those which contain this extension, i.e.
  184.             "TOS;O" does not work, but "O;TOS" does.
  185.     <programname_extension>:
  186.             With this variable you can tell Mupfel if at the start
  187.             of a program the mouse or text cursor should be on or
  188.             off and if a grey background should be drawn. The name
  189.             of this variable corresponds to the program name and
  190.             extension in upper case with the dot replaced by an
  191.             underscore '_', for example $TC_PRG or $GOME_TTP.
  192.             The value may consist of max eight fields separated by
  193.             semicolon or comma. Each field has the format
  194.             [MCBSDWXK]:[YN]. 
  195.                 M:    Mouse on?
  196.                 C:    Text cursor on?
  197.                 B:    Grey background?
  198.                 S:    Pass arguments also with shell_write()?
  199.                 D:    Change the current directory to the
  200.                     directory of the program?
  201.                 W:    (Only for GEMINI!) TOS program output in
  202.                     the console window?
  203.                 X:    Use the EXARG method? (see below)
  204.                 K:    Wait for a key after end of program?
  205.             With "Y" after the colon the function is activated,
  206.             with "N" not.
  207.             If such a variable does not exit, or a field is not
  208.             given the following defaults are used:
  209.             - GEM progs (PRG,APP): M:Y,C:N,B:Y,S:Y,D:Y,W:N,X:Y,K:N
  210.             - TOS progs (TOS,TTP): M:N,C:Y,B:N,S:N,D:N,W:Y,X:Y,K:N
  211.             In the following this variable is mentioned as
  212.             $PRGNAME_EXT.
  213.     TOSDEFAULT and GEMDEFAULT:
  214.             With these two variables you can set the default start
  215.             parameters for TOS and GEM programs. The format is the
  216.             same as described under $PRGNAME_EXT.
  217.     DRIVEMAP:    Contains the list of drive names (only the letters) for
  218.             which the commands "df -a", "pwd -a" and "find -a"
  219.             should give information.
  220.     CONSOLEDIR:    (Only for GEMINI) Here you can indicate in which
  221.             directory you want to be the first time the console
  222.             window is opened.
  223. The names of the environment variables may consist of letters, digits and the
  224. characters '_', '?' and '#'. The character '=' may not occur in the value of an
  225. environment variable.
  226. The commands "setenv", "env" and "show" are for managing the environment.
  227.  
  228.  
  229.                 Internal variables
  230.  
  231. Mupfel has besides the environment also some internal variables. These
  232. variables are used to control internal functions and to pass arguments to
  233. batchfiles. These variables can be referenced in the same way as the environ-
  234. ment variables with a leading $ character. The following variables are defined:
  235. a) Not changeable by the user:
  236.     0,1,...,9    The first 10 arguments for a batchfile. ($0 contains
  237.             the name of the batchfile).
  238.     #        The number of arguments for a batchfile.
  239.     ?        The returncode of the last executed command.
  240.     cwd        In this variable you will find the name of the current
  241.             working directory.
  242.     shellcount    A counter counting the number of times Mupfel is in
  243.             memory.
  244.     drivelist    A list of all the physically connected floppy and hard
  245.             disk drives.
  246. b) Changeable by the user:
  247.     screensave    If this variable is defined then the current text
  248.             screen is saved before the execution of a GEM program
  249.             and afterwards restored. For this at least 32 Kbyte
  250.             memory is dynamically allocated. The exact size is
  251.             determined by the number of pixels and planes of the
  252.             screen (from v_opnvwk() and vq_extnd()). The complete
  253.             screen is copied with vro_cpyfm().
  254.     noclobber    If this variable is defined then an already existing
  255.             file is not overwritten by "normal" I/O redirection.
  256.     history        This variable can be used in the autoexec file (only
  257.             there!) to set the size of the history list. The
  258.             default value is 20.
  259.     keepfree    With this value you can tell how much memory the
  260.             commands cp and mv should *NOT* use (important when
  261.             using for example Alex Esser's FlexDisk). If not
  262.             defined the value 8192 is used.
  263.     errorfile    When this variable is defined it is interpreted as the
  264.             name of a file or device (e.g. CON:) to which GEMDOS
  265.             handle 2 should be redirected for each program/command
  266.             in case no explicit redirection is specified.
  267.             If the filename starts with ">" then the file is
  268.             appended (same as 2>>xxx), otherwise the file is
  269.             created each time (as in 2>xxx). This is usefull for
  270.             programs which use handle 2 for error output (e.g GNU
  271.             programs and MWC). With "set errorfile con:" in the
  272.             autoexec file the errormessages of these programs are
  273.             shown on the screen.
  274.  
  275. These variable names are fixed internally. There cannot exist variables with
  276. the same names in the environment.
  277.  
  278.  
  279.                 I/O redirection
  280.  
  281. Mupfel does I/O redirection itself. By ">file" you can redirect the standard
  282. output of internal and external commands to file. If file already exists, it is
  283. created again. With ">>file" the output is appended to the end of file. With
  284. "<file" you can redirect the standard input to file. The file has to exist.
  285. To create files in spite of "noclobber" you can use ">!" or ">>!" instead of
  286. ">" and ">>" for output redirection.
  287. For the redirection of handle 2 (the serial channel, used in some programs for
  288. error output) you can use "2>", "2>>" etc. in the same way. See also "errorfile"
  289. under "Internal variables".
  290. If you specify input or output redirection for a batchfile then Mupfel repeats
  291. this automatically for each command in the batchfile. You can still specify
  292. the redirection to different files for each single command in the batchfile.
  293. The I/O redirection works only for programs which use GEMDOS handles 0, 1 and 2
  294. for input and output. Warning: In the old ROM TOS there are a few errors which
  295. make it impossible to use this function! (TOS version before 1.4, GEMDOS version
  296. before 00.21)
  297.  
  298. NOTE: The use of software blitters (TurboST or QuickST) makes the redirection
  299. of program output impossible!!
  300.  
  301.  
  302.                 Command execution
  303.  
  304. The first token of each commandline is interpreted as the name of a command to
  305. be executed. If this token does not contain any path components or extensions
  306. (e.g. starts with . or \ or ends with .xxx) then first the list of internal
  307. commands is searched. In case it is not an internal command every component of
  308. $PATH is searched for a program with this name. To do this the extensions
  309. specified in $SUFFIX are appended in order. Files ending in .MUP are batchfiles.
  310. These files are not executed directly, but are text files containing Mupfel
  311. commands. Batchfiles can be nested to any depth. In case there are naming 
  312. conflicts between internal and external commands you can change the just
  313. described search order by using upper case for the first token of a command
  314. line.
  315. If the command is an external command and the commandtail, after token 
  316. expansion, is longer than 124 characters then the arguments are only passed
  317. with the xARG method (see below).
  318. Internal commands can only be started with expanded wildcards, because there
  319. may be unwanted effects or even (because of GEMDOS errors) system crashes.
  320. An exception to this rule are the commands "alias", "echo", "tree", "fkey" and
  321. "setenv".
  322. Internal commands and external TOS or TTP programs can be terminated by
  323. Control-C when they produce output.
  324. External commands inherit the environment. Via the variable $IMV information
  325. is passed about the aliases, the functionkeys, hashtable and some internal
  326. variables. This is usefull for a later started second (or third or ...) Mupfel,
  327. because otherwise this information would not be available.
  328.  
  329.  
  330.                 GEM programs
  331.  
  332. GEM programs are recognized by the extensions .PRG or .APP.
  333. Before their execution the current directory is normally changed to the one
  334. of the program (so resource and other files can be loaded). This function can
  335. be suppressed with the field "D:N" in $PRGNAME_EXT.
  336. Moreover, when not otherwise specified in $PRGNAME_EXT (see above), the text
  337. cursor is switched off, the mouse on, the normal desktop background is
  338. generated and the arguments are passed with shell_write().
  339. Some GEM programs inform the AES with the function shell_write() that another
  340. program is to be started after they end, for example GEM-DRAW which starts
  341. OUTPUT.APP. This starting is done by the AES after the Pterm() call of the
  342. current application. Because programs started with Pexec() are not recognized
  343. by the desktop as separate applications, this function is handled by Mupfel.
  344. A small problem is that you cannot tell the AES after a shell_write() call
  345. that there is no program to start. Mupfel uses a trick to solve this: before
  346. the end of Mupfel the AES is told to start the program $HOME\EXIT.PRG. EXIT.PRG
  347. could be generated form the following C source: "main() {return 0;}".
  348. In case $HOME\EXIT.PRG does not exist then "$SHELL -q" is specified as the
  349. program to start. "Mupfel -q" executes Pterm(0) immediately.
  350.  
  351.  
  352.                 Command hashing
  353.  
  354. Mupfel uses a so called hashtable for external commands. Commands which must
  355. be located in $PATH are entered in this table, so the search does not have
  356. to be repeated when the same command is used later. If a program, already in
  357. the hashtable, is moved to another directory, deleted or renamed then the old
  358. entry is deleted. The next time the command is used $PATH is searched and a
  359. new entry in the hashtable is created.
  360. If the environment variables PATH or SUFFIX are changed or deleted the hashtable
  361. is deleted.
  362.  
  363.  
  364.                 The xARG method
  365.  
  366. The xARG method (proposed by Allan Pratt and Dale Schumacher) allows the passing
  367. of command lines longer than 124 characters to programs. For this purpose the
  368. calling program creates an xARG structure which looks as follows:
  369.  
  370. typedef struct
  371. {
  372.     char xarg_magic[4];        /* contains "xARG" */
  373.     int  xargc;            /* as argc in main() */
  374.     char **xargv;            /* as argv in main() */
  375.     char *xiovector;        /* not used */
  376.     PD   *xparent;            /* pointer to callers basepage */
  377. } XARG;
  378.  
  379. In the environment variable xARG the address of this structure is passed to the
  380. called program as an eight digit hexadecimal numer. The called program has to
  381. check by using xarg_magic if it really is a XARG structure and test by 
  382. comparing the pointer to the parent in its own basepage with xparent if the
  383. information comes from its own parent. You can find an example program for the
  384. use of the xARG method in the file XARG.C.
  385.  
  386.  
  387.                 The EXARG method
  388.  
  389. The EXARG method (since some time standardized by Atari USA) allows, as does
  390. the xARG method, the passing of command lines to programs longer than 124
  391. characters. EXARG is an extension of the method introduced by Marc Williams
  392. where the command line is passed in the environment. The problems with the
  393. Marc Williams method are solved in the EXARG method. In EXARG the variable ARGV
  394. is appended to the end of the environment followed by (separated by '\0') the
  395. individual arguments. To indicate that EXARG is used the length byte of the
  396. command line is given the (normally) illegal value 127 at the Pexec() call.
  397. The child process can now extract the arguments from the environment and has
  398. to (!) remove the ARGV variable from the environment (this is done by over-
  399. writing the 'A' with a '\0'). An example for the use of the EXARG method can
  400. be found in the official Atari description in the file EXARG.TXT.
  401. This method (how wonderfull that Atari has specified a standard) also has a
  402. disadvantage: programs that use the Marc Williams method do not understand this
  403. method of passing arguments. To partially circumvent these problems EXARG is
  404. only used if there is at least one argument to pass. If arguments have to be
  405. passed to these programs you can use the field "X:N" in $PRGNAME_EXT.
  406.  
  407.  
  408.                 The system() call
  409.  
  410. Processes started by Mupfel can "delegate" tasks to Mupfel. This is possible
  411. by using the system variable _shell_p (address 0x4F6). At this address Mupfel
  412. installs a pointer to an internal routine. This routine expects on the stack
  413. a pointer to a command line to be executed. The result of the execution is
  414. returned in the register D0.W. A sample program for calling Mupfel via
  415. _shell_p is in the file SYSTEM.C. Mupfel uses the XBRA method to redirect the
  416. _shell_p vector. The XBRA-id used by MUPFEL is "MUPF". When called via _shell_p
  417. Mupfel first saves the registers D1-D7 and A0-A7. Then a block of 8K memory is
  418. allocated which serves as stack for work in Mupfel. After the command is 
  419. finished this memory is freed again and all registers are restored.
  420. A problem is that _shell_p is not initialized at warm boot. Programs using
  421. system() will find a legal XBRA header after warm boot and will almost
  422. certainly crash. A solution for this problem is the program SHELL0.PRG that
  423. has to be copied to the AUTO folder. SHELL0.PRG and the source code (SHELL0.C
  424. for Turbo-C) are included.
  425.  
  426.  
  427.                 Internal commands
  428.  
  429. The names and functioning of the internal Mupfel commands are strongly
  430. influenced by UNIX(tm) and the Bourne shell. In the following description
  431. optional entries are in [] and repeatable entries are indicated by ....
  432.  
  433.     exit    [arg]
  434.         Terminated Mupfel. If arg is specified and it represents a
  435.         numerical value then it is given as return code to the calling
  436.         program, otherwise 0. When used in batchfiles it terminates
  437.         only execution of the batchfile and returns to the calling
  438.         batchfile or Mupfel.
  439.         In GEMINI this command only leaves the console window.
  440.  
  441.     cd [dir]
  442.         Changes to directory dir. Without arguments the value of $HOME
  443.         is taken. Dir may have a leading drive indication (e.g. C:\BIN).
  444.         If CDPATH exists in the environment and a change to dir is not
  445.         possible then dir is appended to each component of CDPATH in
  446.         turn and a change is tried to the resulting directory.
  447.  
  448.     pwd [-a]
  449.         Pwd (print working directory) without argument shows the current
  450.         directory on the current drive. With the -a (all) option the
  451.         current directories of all drives. The availability of a drive
  452.         is determined in the same way as in "df" (see below).
  453.  
  454.     x:
  455.         Changes the current drive to drive x. If the drive letter is
  456.         given in lower case the directory is changed to the current
  457.         directory of this drive. With an upper case drive letter the
  458.         change is made to the drives root directory.
  459.  
  460.     pushd [dir]
  461.         Stores the indicated directory on a stack. The current direc-
  462.         tory is stored when no argument is given. Relative paths (not
  463.         starting with \ or a drive name) are first expanded to absolute
  464.         paths.
  465.  
  466.     podp
  467.         Retrieves the last stored directory from the stack and does a
  468.         "cd" to it.
  469.  
  470.     dirs
  471.         Shows the contents of the directory stack in LIFO order, i.e.
  472.         the first line of output shows the last pushed directory.
  473.  
  474.     help [cmd...]
  475.         Help alone shows a list with all internal commands. This list
  476.         is output with max $COLUMNS characters in several columns.
  477.         With arguments short help texts for these commands are shown.
  478.  
  479.     cp [-icdvabs] file1 file2
  480.     cp [-icdvabs] file... dir
  481.     cp -r [-a] dir1 dir2
  482.         Cp copies files. In the first format file1 is copied to file2.
  483.         If file2 alraedy exists it is created again. In the second
  484.         format all files are copied into directory dir. When the option
  485.         -c (confirm) is specified then if a target file already exists
  486.         Mupfel asks if it may be overwritten. Possible responses to the
  487.         question are 'y' (copy), 'n' (do not copy and continue), 'q'
  488.         (quit cp command) and 'a' (do not ask anything from now on).
  489.         With the option -i (interactive) Mupfel asks for each file if it
  490.         should be copied or not. Possible answers are the same as for
  491.         "cp -c".
  492.         With the option -d (date) the target file modification date is
  493.         the same as the one of the source file. Otherwise the current 
  494.         system date and time are used.
  495.         With the option -r (recursive) the complete directory tree under
  496.         dir1 is copied to dir2. If dir2 does not exist it is created.
  497.         With the -v (verbose) option each filename is shown.
  498.         Cp copies also the file attributes (see chmod) if the '-a' (ar-
  499.         chive) option is not specified. If '-a' is specified then only
  500.         the files with a set archive bit are copied. After a success-
  501.         full copy the archive bit of the source file is cleared (see
  502.         also chmod).
  503.         With the -b (brute force) option it is possible to overwrite
  504.         write protected files.
  505.         With the -s (secure) option the copy is not made (as otherwise)
  506.         directly to the target file, but first to an intermediate file.
  507.         Only when this succeeds the target file is deleted and the
  508.         intermediate file is renamed. The intermediate file has the
  509.         same name as the target file, only the extension is replaced
  510.         with $$$. If a file with this name already exists it is quietly
  511.         overwritten.
  512.  
  513.     mv [-icvb] file1 file2
  514.     mv [-icvb] files... dir
  515.     mv [-icv] dir1 dir2
  516.         Mv renames files. This works within one logical drive with the
  517.         GEMDOS function Frename(). In case of different drives for
  518.         source and target first a copy is done (with cp) and then the
  519.         source file is deleted.
  520.         The first format renames file1 to file2. If file2 already
  521.         exists it is created again.
  522.         The second format moves all files into the directory dir.
  523.         The third format renames the directory dir1. This only works
  524.         for TOS versions from 1.4 onward.
  525.         The -c, -i and -v options work in the same way as for cp.
  526.         Mv never changes the modification date of a file.
  527.         Within a logical drive you cannot rename write protected files
  528.         unless the -b (brute force) option is used. With -b mv can
  529.         both rename write protected files and give a name to a file
  530.         which is already used by another write protected file.
  531.  
  532.     rename [-icv] ext files...
  533.         Rename renames all indicated files by changing their extensions
  534.         to ext. Files with no extension will get the extension ext.
  535.         Exit may start with a dot but may not be followed by more than
  536.         1 to 3 characters.
  537.         The options -i, -c and -v work the same as for cp.
  538.  
  539.     rm [-rivfb] files...
  540.         Rm deletes files. With the -i (interactive) option Mupfel will
  541.         ask for each file if it should be deleted. Possible answers are
  542.         'y' (delete file), 'n' (don't delete and continue with the next
  543.         one) or 'q' (quit rm command).
  544.         The option -r (recursive) deletes whole directory trees.
  545.         The option -v is the same as in cp and mv.
  546.         With the -f (failure) option no error message is given when one
  547.         of the files to be deleted does not exist and the return code
  548.         is always 0.
  549.         Rm cannot delete write protected files when the -b (brute force)
  550.         option is not specified.
  551.  
  552.     mkdir dir...
  553.     rmdir dir...
  554.         Deletes directories (rmdir) or creates them (mkdir). Rmdir can
  555.         only delete directories without files or subdirectories. Mkdir
  556.         can only create a directory when no other file with the same
  557.         name exists.
  558.  
  559.     chmod [+-] [aswh] files...
  560.         Chmod changes file attributes. With + or - you can set, respec-
  561.         tively clear, attributes. The attribute codes mean:
  562.             a - The archive bit. Used by backup programs and
  563.                 "cp -a".
  564.             s - The system bit. Hides a file on the desktop.
  565.             h - The hidden bit. Hides a file on the desktop.
  566.             w - The write-enable bit. Changes the write protection
  567.                 of a file.
  568.  
  569.     touch [-c] [-d hhmm|ddmmhhmm[yy]] files...
  570.         Touch sets the modification date of all files to the current
  571.         date. If a file does not exist it is created. The -c (create)
  572.         option suppresses this creation.
  573.         With the -d option you can specify what modification date to
  574.         set. The format for the date corresponds to the one for the
  575.         "date" command.
  576.  
  577.     ls [-srtldcufh] [files...]
  578.         Ls shows the contents of directories. Normally the files are
  579.         shown sorted in one column under eachother. If an argument is
  580.         a directory then all the files in this directory are shown.
  581.         This normal functioning of ls can be influenced with the
  582.         following options:
  583.             -l (long):    Except for the name also the attributes,
  584.                     size, modification date and time are
  585.                     given.
  586.             -d (directory):    Directories are shown as such.
  587.             -c (columns):    The output is in columns with max
  588.                     $COLUMNS characters per line.
  589.             -u (unsorted):    The output is not sorted but is in the
  590.                     order in which the files are in the
  591.                     directory on the floppy/disk.
  592.             -s (size):    The files are not sorted by name but by
  593.                     size, the largest one first.
  594.             -t (time):    The files are sorted by modification
  595.                     date, newest file first.
  596.             -r (reverse):    The sorting is reversed.
  597.             -f (filetype):    For directories a "\" is appended to the
  598.                     name, for executable programs (files
  599.                     whose extension is in $SUFFIX) a "*".
  600.             -h (hidden):    Files with the hidden attribute (see
  601.                     chmod) are normally not shown. They
  602.                     are included with -h.
  603.         The option -u overrides -s, -t and -r.
  604.         The option -l overrides -c.
  605.  
  606.     lu
  607.         Same as "ls -u"
  608.  
  609.     lc
  610.         Same as "ls -c"
  611.  
  612.     ll
  613.         Same as "ls -l"
  614.  
  615.     echo [args...]
  616.         Echo echoes its arguments. In the arguments the following
  617.         special sequences are allowed:
  618.             %%    echoes as %
  619.             %t    echoes as TAB
  620.             %n    echoes as CR/LF
  621.             %c    (only at the end of the last argument) sup-
  622.                 presses the following CR/LF.
  623.             %0    lead-in sequence for an arbitrary character
  624.                 represented by max 3 octal digits.
  625.                 "echo %033E" for example clears the screen.
  626.  
  627.     cat files...
  628.         Cat outputs the contents of the indicated files. Cat without
  629.         arguments reads from the keyboard untill the character
  630.         Control-D (ASCII End-Of-Text) is input or the Undo key is
  631.         pressed.
  632.  
  633.     more files...
  634.         More outputs the contents of the indicated files. It shows
  635.         always one screen full (determined by $ROWS) and waits for
  636.         input. The allowed inputs and their function are (^X means
  637.         Control-X, upper and lower case have the same effect):
  638.             SPACE,F,^F,Shift-down arrow    Next page
  639.             RETURN,J,+,down arrow        Next line
  640.             ^B,B,Shift-up arrow        Previous page
  641.             K,-,up arrow            One line back
  642.             0,Clr/Home            To start of file
  643.             $,G,Shift-Cr/Home        To end of file
  644.             ESC,UNDO,Q,^C            Quit more
  645.             N                To next file
  646.             P                To previous file
  647.             HELP,H                Show help
  648.             /,?                Search (/=forward,
  649.                             ?=backward)
  650.             A                Repeat last search
  651.             ^G                Show info
  652.         With the / and ? commands more expects the search string to be
  653.         input on the bottom line. An empty line repeats the last search
  654.         (same as A). The search is always exact, i.e. upper and lower
  655.         case are not the same. More tries always to show the found line
  656.         as high as possible on the screen. If the search reaches the
  657.         beginning or end of file the search direction for the next A
  658.         command is automatically reversed.
  659.         ADVICE: You should not redirect the output of more since it
  660.         contains escape sequences to control the screen.
  661.  
  662.     print [-f|-l lin] files...
  663.         Print sends the indicated files to the printer.
  664.         With the -f (formfeed) option a formfeed is appended to each
  665.         file.
  666.         With the -l (lines) option a formfeed is sent after every lin
  667.         number of lines.
  668.  
  669.     whereis cmd
  670.         Searches cmd in the alias list, the internal command list, the
  671.         hashtable and in $PATH.
  672.         Lower case arguments are first searched internally and then
  673.         in $PATH, upper case arguments the other way around.
  674.  
  675.     df [-a|drv:]
  676.         Without arguments shows the free space on the current drive.
  677.         With the -a (all) option this is done for all connected drives
  678.         or for those specified in the environment variable DRIVEMAP.
  679.         If DRIVEMAP is not defined then the function Drvmap() is used
  680.         to determine which drives are connected. Because this will
  681.         always include drives A: and B: the system variable _nflops
  682.         (address 0x4A6) is checked to find out how many floppy drives
  683.         are really connected.
  684.         If a drive name is given (e.g. C:) then only the free space for
  685.         this drive is given.
  686.  
  687.     label [drv [volnam]]
  688.         Label alone shows the volume label of the current drive. If drv
  689.         is given the volume label for this drive is shown. With three
  690.         arguments the volume label of the indicated drv is changed to
  691.         volnam. Volnam may not be equal to a file or directory name
  692.         in the root directory of this drive. If volnam consists of a
  693.         single minus character the volume label of the indicated drive
  694.         is deleted.
  695.         Note: Some versions of TOS 1.4 do not support the creation of
  696.         volume labels, in others (e.g the one from 6.4.89) it is not
  697.         possible to delete a volume label (you can only replace the
  698.         label by an other one).
  699.  
  700.     backup [-icv] files...
  701.         Copies all indicated files changing their extension to .BAK.
  702.         The options -i, -c and -v work the same as for cp.#
  703.  
  704.     tree [-di] [-f filespec] [-p path]
  705.         Shows directory trees starting from path or from the current
  706.         directory. If "-f filespec" is given (filespec may contain
  707.         a wildcard expression (see above)) then only files matching
  708.         the filespec expression are shown. The default for filespec
  709.         is "*".
  710.         Note: You have to use quoting when filespec contains wildcards.
  711.         With the -d (directory) option only directories are shown.
  712.         With -i (indent) the position of the file in the tree is shown
  713.         by indentation.
  714.         If the start directory is the only option then the "-p" may be
  715.         omitted, e.g. "tree -p xxx" is equivalent to "tree xxx".
  716.  
  717.     find directory patterns...
  718.         Find searches from the indicated directory for all files with
  719.         names that match one of the given patterns. A pattern may
  720.         contain a normal wildcard expression (see above). When, instead
  721.         of directory, "-a" is specified find searches all drives given
  722.         in $DRIVEMAP. If $DRIVEMAP does not exist then all connected
  723.         drives are searched.
  724.  
  725.     hash [-r]
  726.         Without an argument the hashtable for external commands is
  727.         displayed. The entries mean:
  728.             Hits:        Number of times this program is called.
  729.             Cost:        Initial effort to find the program.
  730.             Cmd:        Command name.
  731.             Full Path:    Complete path of the called program.
  732.         The -r (remove) options clears the hashtable. The hashtable
  733.         is cleared automatically when the environment variables $PATH
  734.         or $SUFFIX are changed.
  735.  
  736.     setenv [var [val]]
  737.         Without arguments all environment variables are shown.
  738.         With only one argument var is deleted from the environment.
  739.         With two arguments var is entered into the enviroment with
  740.         contents val or the previous contents of var is changed to val.
  741.         Upper and lower case are not identical!
  742.         Note: var does not need a leading '$' character and a '='
  743.         sign is not needed between var and val!
  744.  
  745.     show [var]
  746.     env [var]
  747.         Without arguments all environment variables are shown.
  748.         Otherwise the contents of environment variable var is shown
  749.         in the form var=value. You can also display internal variables
  750.         with "env var" or "show var".
  751.  
  752.     set [var [val]]
  753.         Without arguments the current values of the internal variables
  754.         are shown.
  755.         The contents of var are deleted with 'set var'.
  756.         The value of var is changed to val with 'set var val'.
  757.  
  758.     var=val
  759.         Changes the contents of the internal or environment variable
  760.         var to val.
  761.  
  762.     var=
  763.         Deletes the internal or environment variable var.
  764.  
  765.     alias [name [replacement]]
  766.         Alias manages the internal alias list. Without arguments the
  767.         current alias list is shown. With one argument the alias for
  768.         name is deleted. With two arguments the alias of name is set
  769.         to replacement.
  770.         If replacement contains more than one token then you need to
  771.         quote the replacement text with single or double quotes.
  772.         The alias list is always sorted alphabetically.
  773.  
  774.     noalias cmnd
  775.         The purpose of noalias is to execute cmnd without alias
  776.         expansion. This may be usefull if you normally use an alias
  777.         like "alias cp 'cp -i'" but you'd like to use the 'normal' cp
  778.         in a batchfile. In such a case you can use "noalias cp ..."
  779.         in the batchfile.
  780.  
  781.     fkey [key [text]]
  782.         Without arguments the current keybindings for the function keys
  783.         F1 to F10 and Shift-F1 to Shift-F10 are shown. The argument
  784.         key may be a number between 1 and 20 or the name of a function
  785.         key (F1, F2, ... F10, SF1, SF2, ... SF10). With only the key
  786.         argument the binding for function key key is deleted. With
  787.         two argument the function key binding is set to text. If the
  788.         last character of text is a "|" then it is replaced by CR when
  789.         the function key is pressed.
  790.  
  791.     date [hhmm|ddmmhhmm[yy]]
  792.         Shows the current date and time without arguments.
  793.         With an argument the internal hardware clock and the GEMDOS
  794.         clock are set. The following three formats are possible:
  795.             hhmm        hour/minute
  796.             mmddhhmm    month/day/hour/minute
  797.             mmddhhmmyy    month/day/hour/minute/year
  798.         If not all values are given the corresponding values from
  799.         the ST current date and time are taken.
  800.  
  801.     wc [-lcw] files...
  802.         Wc (word count) counts lines, words and characters in files.
  803.         If one or more options are given only the corresponding values
  804.         are shown. The options mean:
  805.             -l    count lines
  806.             -w    count words
  807.             -c    count characters
  808.         If several files are given then a line with the corresponding
  809.         totals is shown.
  810.  
  811.     du [directories]
  812.         Du (disk usage) determines the size of the given directories
  813.         (or of "." when no argument is given). The total size of all
  814.         files below the start directory, the number of files and the
  815.         number of directories below the start directory are shown.
  816.  
  817.     file files...
  818.         File tries to determine the type of files by examining the
  819.         first 512 bytes of each file.
  820.  
  821.     init [-y][-s 1|2] drv
  822.         Init overwrites the first two tracks of a diskette in drive A
  823.         or B with zero sectors. This clears the root directory and the
  824.         FAT. Then a new boot sector with a random serial number is
  825.         generated. The -s (sides) option is used to tell if the
  826.         diskette is single (1) or double (2) sided. After "init" the
  827.         diskette always has 9 sectors per track!
  828.         Normally init asks for confirmation is you really want to
  829.         initialize the diskette. With the -y option this question is
  830.         already answered with yes.
  831.  
  832.     timer [-s]
  833.         The timer command with the -s options sets an internal timer
  834.         to the current value of the system variable _hz_200 (0x4ba).
  835.         Without this option the difference between this timer and the
  836.         current value of _hz_200 converted to seconds is shown. At the
  837.         start of Mupfel this timer is initialized automatically. If you
  838.         have not used 'timer -s' the timer command measures the
  839.         running time of Mupfel.
  840.  
  841.     setscrap [-fq] [dir]
  842.         With setscrap you can display or set the AES scrap path. The
  843.         current scrap path is displayed without arguments. With a
  844.         directory name the scrap path is set to the indicated directory.
  845.         The name must be an absolute path, i.e. it has to start with a
  846.         drive (for example "C:\CLIPBRD", DR recommends to use the
  847.         directory CLIPBRD on the boot drive as the scrap path) and it
  848.         has to be an existing directory. Normally setscrap only allows
  849.         the setting of the scrap path if no one has been defined.
  850.         This may be overridden with the -f (force) option. The -q
  851.         (quiet) option suppresses error messages. A recommended way
  852.         of using setscrap in the autoexec file MUPFEL.MUP is the
  853.         following:
  854.             setenv SCRAPDIR c:\clipbrd
  855.             setscrap -q $SCRAPDIR
  856.  
  857.     blitmode [on|off]
  858.         Blitmode without options shows the status of the blitter chip
  859.         (not installed, on or off). With an option you can switch the
  860.         blitter on or off (if installed of course).
  861.  
  862.     version [-amgdt]
  863.         Version shows the relevant version numbers of the system soft-
  864.         ware and of Mupfel. Without options the Mupfel's version
  865.         number is shown. The options mean:
  866.             -m:    display Mupfel version
  867.             -g:    display GEM version
  868.             -d:    display GEMDOS version
  869.             -t:    display TOS version, manufacturing date and
  870.                 country code
  871.             -h:    display the version of a AHDI 3.01 compatible
  872.                 hard disk driver, if one is installed
  873.             -a:    display all versions
  874.  
  875.     shrink [-b val][-t val][-f][-i]
  876.         The purpose of shrink is to reduce the available memory. This
  877.         command is intended for programmers with 'large' computers
  878.         who want to test if their programs work on 'small' machines.
  879.         The -b (shrink by) and -t (shrink to) options reduce the
  880.         available memory. '-b' reduces the current available memory by
  881.         the value val. '-t' reduces the memory such that still 'val'
  882.         bytes are available. Val may be given in octal (recognized
  883.         by a leading zero), decimal or hexadecimal (recognized by a
  884.         leadin 0x or 0X). You can use the suffix k or m for easy input
  885.         of kilo- or megabyte values respectively. The following
  886.         values are identical:
  887.             20480    050000    20k    0x14k
  888.         The -i (info) option shows how much the memory currently is
  889.         reduced and how much memory is still available. Shrink without
  890.         arguments does the same. The -f (free) option makes all
  891.         memory available again.
  892.         You have to add the results of several consecutive shrink -b or
  893.         shrink -t.
  894.         INFO: shrink reserves memory with the GEMDOS function Malloc().
  895.         This does not allow to determine the TPA size of child 
  896.         processes exactly, but it is sufficient for testing purposes.
  897.  
  898.     pause [args]
  899.         The pause command (usefull in batch files) waits for a key
  900.         press. If there are arguments then these are output as with
  901.         echo (see above) (a trailing CR/LF is never output), otherwise
  902.         the text "Press RETURN..." is output. Then pause waits for an
  903.         (almost) arbitrary key press (Shift, Ctrl, Alt, CapsLock, the
  904.         mouse and joystick keys as well as the reset button do not have
  905.         the wanted effect :-)
  906.  
  907.     cookie
  908.         The cookie command shows the contents of the cookie jar, in
  909.         case it is installed. The cookie jar is a collection of flags
  910.         supported from TOS 1.6 (the STe TOS).
  911.  
  912. --------------------------------------------------------------------
  913. UNIX is a trademark of you-know-who
  914.